package entities;

import java.io.Serializable;
import javax.persistence.*;

import java.util.Date;


/**
 * The persistent class for the schueler database table.
 * 
 */
@Entity
@NamedQueries({
	@NamedQuery(name="alleSchueler", query = "SELECT s FROM Schueler s"),
	@NamedQuery(name="schuelerNachNamen", query =
			"SELECT s FROM Schueler s WHERE LOWER(s.name) LIKE :namensbeginn"),
	@NamedQuery(name="schuelerEinerKlasse", 
			query = "SELECT s FROM Schueler s WHERE s.klasse = :klasse")
})	
public class Schueler implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int nummer;

	@Temporal(TemporalType.DATE)
	private Date geburtsdatum;

	private String name;
	
	@ManyToOne
	@JoinColumn(name="fk_klasse")
	private Klasse klasse;
	

	public Schueler() 
	{
	}

	public int getNummer() {
		return this.nummer;
	}

	public void setNummer(int nummer) {
		this.nummer = nummer;
	}

	public Date getGeburtsdatum() {
		return this.geburtsdatum;
	}

	public void setGeburtsdatum(Date geburtsdatum) {
		this.geburtsdatum = geburtsdatum;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String toString()
	{
		return "Schueler [nummer=" + nummer + ", geburtsdatum=" + geburtsdatum
				+ ", name=" + name + "]";
	}

	public Klasse getKlasse()
	{
		return klasse;
	}

	public void setKlasse(Klasse klasse)
	{
		this.klasse = klasse;
	}

}